<% // Copyright 2008 Carnegie Mellon University
// Licensed under the Apache License, Version 2.0 (the "License"); 
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//  
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, 
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License. %><%@page language="java" contentType="text/html; charset=UTF-8" %><%@page pageEncoding="UTF-8" %><%@page import="edu.cmu.lti.sepia.util.ServletUtil"%><%@page import="edu.cmu.lti.sepia.data.session.SessionManager"%><%@page import="edu.cmu.lti.sepia.data.resource.ResourceManager"%><%@page import="edu.cmu.lti.sepia.data.db.*"%><%@page import="edu.cmu.lti.sepia.util.Logger"%><%
request.setCharacterEncoding("UTF8");
response.setContentType("text/plain; charset=utf-8");
response.setHeader("progma", "no-cache");
response.setHeader("Cache-Control", "no-cache");

SQL sql = new SQL();
ServletUtil s = new ServletUtil( request );
String taskNameShort;
String trgLang;
if ( request.getParameter("taskNameShort")!=null ) {
	taskNameShort = (String)request.getParameter("taskNameShort");
	trgLang = (String)request.getParameter("trgLang");
	SessionManager.storeTask(sql, taskNameShort, session);
} else {
	taskNameShort = (String)session.getAttribute("taskNameShort");
	trgLang = (String)session.getAttribute("trgLang");
}
response.setHeader("Content-Disposition","attachment; filename=\""+taskNameShort+"-qajudgments.txt"+"\"");

QAJudgmentResultDAO.exportJudgments(sql, taskNameShort, trgLang, out );
Logger.log( sql, session, "EXPORT QA JUDGMNETS", "" );
sql.close();
%>